package com.example.icampusevent;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TabHost;

public class Main extends TabActivity {
	public static TabHost tabHost;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Resources res = getResources(); // Resource object to get Drawables
		tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Resusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab

		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this, Events.class);
		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost
				.newTabSpec("events")
				.setIndicator("Events",
						res.getDrawable(R.drawable.events_icon))
				.setContent(intent);
		tabHost.addTab(spec);
		
		
		intent = new Intent().setClass(this, Map.class);
		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost
				.newTabSpec("map")
				.setIndicator("Map",
						res.getDrawable(R.drawable.map_icon))
				.setContent(intent);
		tabHost.addTab(spec);		
		
		intent = new Intent().setClass(this, Settings.class);
		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost
				.newTabSpec("settings")
				.setIndicator("Settings",
						res.getDrawable(R.drawable.settings_icon))
				.setContent(intent);
		tabHost.addTab(spec);		
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
}
